from langchain import OpenAI, SQLDatabase, SQLDatabaseChain
from langchain.chains import SQLDatabaseSequentialChain
db = SQLDatabase.from_uri(
    "mysql+pymysql://root:password@115.159.119.116:3306/openai_demo",
    include_tables=['data_wide_mdm_myuser'],
    sample_rows_in_table_info=2
    )
llm = OpenAI(temperature=0)


db_chain = SQLDatabaseSequentialChain.from_llm(llm, db, verbose=True)
# db_chain.run("How many users are there?")
db_chain.run("有多少数据?")
